<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
  <title>RoughJS Polygon</title>
</head>

<body>
  <canvas width="800" height="800"></canvas>

  <script type="module">
    import rough from '../../bin/rough.js';
    const canvas = document.querySelector('canvas');
    const rc = rough.canvas(canvas);

    rc.polygon([
      [10, 10],
      [200, 10],
      [100, 100],
      [100, 50],
      [300, 100],
      [60, 200]
    ], { stroke: 'black', strokeWidth: 2, fill: 'red', hachureAngle: 90 });

    canvas.getContext('2d').translate(0, 210);
    rc.polygon([
      [10, 10],
      [200, 10],
      [100, 100],
      [100, 50],
      [300, 100],
      [60, 200]
    ], { fill: 'red', fillStyle: 'solid' });

    canvas.getContext('2d').translate(0, 210);
    rc.polygon([
      [10, 10],
      [200, 10],
      [100, 100],
      [100, 50],
      [300, 100],
      [60, 200]
    ], { fill: 'red', fillStyle: 'dots', hachureGap: 16, fillWeight: 2 });

    canvas.getContext('2d').translate(300, 0);
    rc.polygon([
      [10, 10],
      [200, 10],
      [100, 100],
      [100, 50],
      [300, 100],
      [60, 200]
    ], { fill: 'red', fillStyle: 'cross-hatch', hachureGap: 8 });

    canvas.getContext('2d').translate(0, -210);
    rc.polygon([
      [10, 10],
      [200, 10],
      [100, 100],
      [100, 50],
      [300, 100],
      [60, 200]
    ], { fill: 'red', fillStyle: 'zigzag', hachureGap: 8 });

    canvas.getContext('2d').translate(0, -210);
    rc.polygon([
      [10, 10],
      [200, 10],
      [100, 100],
      [100, 50],
      [300, 100],
      [60, 200]
    ], { stroke: 'orange', strokeWidth: 5 });

  </script>
</body>

</html>